//
//  MusicLibraryViewController.m
//  GSG
//
//  Created by dllo on 15/4/21.
//  Copyright (c) 2015年 dllo. All rights reserved.
//

#import "MusicLibraryViewController.h"
#import "MusicCell.h"
#import "NewSongPublishViewController.h"
#import "RankingViewController.h"
#import "SingerViewController.h"
#import "RadioStationViewController.h"
#import "MoveViewController.h"
#import"PlayListViewController.h"
@interface MusicLibraryViewController ()<UITableViewDataSource,UITableViewDelegate>
@property (nonatomic,retain)UITableView *musicTableView;
@property (nonatomic,retain)NSMutableArray *musicArr;

@end
@implementation MusicLibraryViewController
- (void)dealloc
{
    [_musicTableView release];
    [_musicArr release];
    [super dealloc];
}

- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        self.title = @"乐库";
        self.musicArr = [[NSMutableArray alloc] init];
        
    }
    return self;
}
-(void)actionBuLand{
    PlayListViewController *plvc=[[PlayListViewController alloc]init];
    [self.navigationController pushViewController:plvc animated:YES];
    [plvc release];
    
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.rightBarButtonItem=[[UIBarButtonItem alloc]initWithTitle:@"播放" style:UIBarButtonItemStyleDone target:self action:@selector(actionBuLand)];
 self.navigationItem.rightBarButtonItem.tintColor=[UIColor whiteColor];
    
    self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"bujing.png"]];
    
    UIButton *newSongButton = [UIButton buttonWithType:UIButtonTypeCustom];
    newSongButton.frame = CGRectMake(self.view.frame.size.width * 15 / 375, self.view.frame.size.height * 10 / 667+64, self.view.frame.size.width *345/375, self.view.frame.size.height*160/667);
    [newSongButton setImage:[UIImage imageNamed:@"新歌首发.png"] forState:UIControlStateNormal];
    [newSongButton addTarget:self action:@selector(newsong:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:newSongButton];
    
    UILabel *laber = [[UILabel alloc] initWithFrame:CGRectMake(self.view.frame.size.width * 10 / 375, self.view.frame.size.height * 10 / 667, self.view.frame.size.width * 100 / 375, self.view.frame.size.height * 30 / 667)];
    laber.text = @"新歌首发";
    laber.textColor = [UIColor whiteColor];
    [newSongButton addSubview:laber];
    
    
    
    UIButton *rankButton = [UIButton buttonWithType:UIButtonTypeCustom];
    rankButton.frame = CGRectMake(self.view.frame.size.width * 15 / 375, self.view.frame.size.height * 180 / 667+64, self.view.frame.size.width *345/375, self.view.frame.size.height*160/667);
    [rankButton setImage:[UIImage imageNamed:@"排行.png"] forState:UIControlStateNormal];
    [rankButton addTarget:self action:@selector(ranking:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:rankButton];
    
    UILabel *ranklaber = [[UILabel alloc] initWithFrame:CGRectMake(self.view.frame.size.width * 10 / 375, self.view.frame.size.height * 10 / 667, self.view.frame.size.width * 100 / 375, self.view.frame.size.height * 30 / 667)];
    ranklaber.text = @"排行";
    ranklaber.textColor = [UIColor whiteColor];
    [rankButton addSubview:ranklaber];
    
    
    
//    UIButton *singerButton = [UIButton buttonWithType:UIButtonTypeCustom];
//    singerButton.frame = CGRectMake(self.view.frame.size.width * 15 / 375, ((self.view.frame.size.height) - (self.view.frame.size.height * 100 / 667)) / 5 * 2 + (self.view.frame.size.height * 115 / 667), (self.view.frame.size.width) - (self.view.frame.size.width * 30 / 375), ((self.view.frame.size.height) - (self.view.frame.size.height * 100 / 667)) / 5 + (self.view.frame.size.height * 15 / 667));
//    [singerButton setImage:[UIImage imageNamed:@"歌手.png"] forState:UIControlStateNormal];
//    [singerButton addTarget:self action:@selector(singer:) forControlEvents:UIControlEventTouchUpInside];
//    [self.view addSubview:singerButton];
//    
//    UILabel *singerLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.view.frame.size.width * 10 / 375, self.view.frame.size.height * 10 / 667, self.view.frame.size.width * 100 / 375, self.view.frame.size.height * 30 / 667)];
//    singerLabel.text = @"歌手";
//    singerLabel.textColor = [UIColor whiteColor];
//    [singerButton addSubview:singerLabel];
    
    
    UIButton *readioButton = [UIButton buttonWithType:UIButtonTypeCustom];
    readioButton.frame = CGRectMake(self.view.frame.size.width * 15 / 375, self.view.frame.size.height * 350 / 667+64, self.view.frame.size.width *345/375, self.view.frame.size.height*160/667);
    [readioButton setImage:[UIImage imageNamed:@"电台.png"] forState:UIControlStateNormal];
    [readioButton addTarget:self action:@selector(readio:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:readioButton];
    
    UILabel *readioLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.view.frame.size.width * 10 / 375, self.view.frame.size.height * 10 / 667, self.view.frame.size.width * 100 / 375, self.view.frame.size.height * 100 / 667)];
    readioLabel.text = @"MV";
    readioLabel.textColor = [UIColor whiteColor];
    [readioButton addSubview:readioLabel];

}
- (void)newsong:(UIButton *)button{
    NewSongPublishViewController *newSong = [[NewSongPublishViewController alloc]init];
    [self.navigationController pushViewController:newSong animated:YES];
    [newSong release];
}
- (void)ranking:(UIButton *)button{
    RankingViewController *rangking = [[RankingViewController alloc]init];
    [self.navigationController pushViewController:rangking animated:YES];
    [rangking release];
    
}
//- (void)singer:(UIButton *)button{
//    SingerViewController *singer = [[SingerViewController alloc]init];
//    [self.navigationController pushViewController:singer animated:YES];
//    [singer release];
//    
//}
- (void)readio:(UIButton *)button{
    MoveViewController *radio = [[MoveViewController alloc]init];
    [self.navigationController pushViewController:radio animated:YES];
    [radio release];
    
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return self.musicArr.count;
    
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *reuse = @"reuse";
    MusicCell *cell = [tableView dequeueReusableCellWithIdentifier:reuse];
    if (!cell) {
        cell = [[[MusicCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reuse] autorelease];
    }
    

    
    return cell;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
